package org.jeecg.modules.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.api.DemoApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags="调试")
@RestController
@RequestMapping("demo")
@Slf4j
public class DemoController implements DemoApi {

    @Autowired
    @Lazy
    private ISysBaseAPI baseAPI;

    @Override
    @ApiOperation(value = "测试")
    public String getOne() {
        return "123";
    }

    @GetMapping("demo2")
    @ApiOperation(value = "测试2")
    public String getSystem(){
        LoginUser admin = baseAPI.getUserByName("admin");

        return admin.getRealname();
    }
}
